package com.sl.water.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sl.water.dao.BRiskPersonDao;
import com.sl.water.entity.BRiskPerson;
import com.sl.water.service.BRiskPersonService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;


@Service
public class BRiskPersonServiceImpl extends ServiceImpl<BRiskPersonDao, BRiskPerson> implements BRiskPersonService {

    @Override
    public Page<BRiskPerson> pageList(int page, int size, String kind) {
        LambdaQueryWrapper<BRiskPerson> queryWrapper = new LambdaQueryWrapper<>();
        Page<BRiskPerson> personPage = new Page<>(page, size);
        if (StringUtils.isNoneEmpty(kind)) {
            queryWrapper.eq(BRiskPerson::getKind, kind);
        }
        queryWrapper.orderByDesc(BRiskPerson::getCreatedTime);
        return this.page(personPage, queryWrapper);

    }
}

